import React, { Component } from 'react';
import './index.css'
import Search from './components/Search';
import List from './components/List';
import Paging from './components/Paging';

export default class App extends Component {
  state = {
    users: [], //初始化数据,users初始值为空数组
    isFirst: true, //是否第一次打开页面
    isLoading: false, //是否加载中
    err: '', //保存错误信息
    current: 1, //当前页码
    pageSize: 30, //每页显示的条数
    goValue: 0,  //要取的条数index
    totalPage: 0,//总页数
  };

  //更新App状态
  updateAppState = (stateObj) => {
    this.setState(stateObj)
  }

  render() {
    return (
      <div className="container">
        <Search updateAppState={this.updateAppState}></Search>
        <List {...this.state} ></List>
        <Paging {...this.state}></Paging>
      </div>
    );
  }
}